WPS Office.apk(点击下载) / ofi.java


package defpackage;

import cn.wps.moffice.writer.core.TextDocument;
import cn.wps.moffice.writer.io.writer.docx.DocxWriter;
import defpackage.msj;
import defpackage.msq;
import defpackage.msr;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;

/* renamed from: ofi  reason: default package */
public final class ofi {
    private static HashMap<Integer, Integer> quF = null;

    public static final int Vt(int i) {
        if (quF == null) {
            quF = new HashMap<>();
        }
        int size = quF.size() + 1;
        quF.containsKey(Integer.valueOf(i));
        ew.eE();
        quF.put(Integer.valueOf(i), Integer.valueOf(size));
        return size;
    }

    private static final void a(TextDocument textDocument, msq msq, odf odf) throws IOException {
        ArrayList<String> arrayList;
        ew.assertNotNull("textDoc should not be null!", textDocument);
        ew.assertNotNull("footEndNoteRef should not be null!", msq);
        ew.assertNotNull("w should not be null!", odf);
        mgh mgh = (mgh) textDocument.Oe(4);
        ew.assertNotNull("endNoteDoc should not be null!", mgh);
        msr msr = mgh.oQH;
        ew.assertNotNull("footEndNoteTxt should not be null!", msr);
        msj.f fVar = msr.pjm;
        ew.assertNotNull("footEndNoteTxtHeadNode should not be null!", fVar);
        odf.i("w:endnotes", "xmlns:w", "http://schemas.openxmlformats.org/wordprocessingml/2006/main", "xmlns:wp", "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing", "xmlns:r", "http://schemas.openxmlformats.org/officeDocument/2006/relationships", "xmlns:v", "urn:schemas-microsoft-com:vml", "xmlns:w10", "urn:schemas-microsoft-com:office:word", "xmlns:o", "urn:schemas-microsoft-com:office:office", "xmlns:wp14", "http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing", "xmlns:w14", "http://schemas.microsoft.com/office/word/2010/wordml", "xmlns:mc", "http://schemas.openxmlformats.org/markup-compatibility/2006", "xmlns:m", "http://schemas.openxmlformats.org/officeDocument/2006/math", "xmlns:wps", "http://schemas.microsoft.com/office/word/2010/wordprocessingShape", "xmlns:wpg", "http://schemas.microsoft.com/office/word/2010/wordprocessingGroup", "xmlns:wpi", "http://schemas.microsoft.com/office/word/2010/wordprocessingInk", "xmlns:wpc", "http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas", "mc:Ignorable", "w14 wp14");
        msj.g dOv = msq.dOv();
        while (dOv.hasNext()) {
            msq.a aVar = (msq.a) dOv.dOx();
            msr.a aVar2 = aVar.pjV;
            ew.assertNotNull("endNoteDoc should not be null!", mgh);
            ew.assertNotNull("refNode should not be null!", aVar);
            ew.assertNotNull("txtNode should not be null!", aVar2);
            ew.assertNotNull("commentTxtHeadNode should not be null!", fVar);
            ew.assertNotNull("w should not be null!", odf);
            ArrayList<String> arrayList2 = new ArrayList<>();
            int dOw = aVar2.dOw();
            ew.assertNotNull(quF);
            Integer num = quF.get(Integer.valueOf(dOw));
            if (num == null) {
                arrayList = arrayList2;
            } else {
                arrayList2.add("w:id");
                arrayList2.add(Integer.toString(num.intValue()));
                arrayList = arrayList2;
            }
            odf.d("w:endnote", arrayList);
            int dOw2 = aVar2.dOw();
            msj.h dOG = aVar2.dOG();
            int length = dOG.equals(fVar) ? mgh.getLength() : dOG.dOw();
            ew.eH();
            ew.assertNotNull("cPieceTable should not be null!", mgh.oQf);
            DocxWriter.a(mgh, dOw2, length, 0, odf, 4);
            odf.endElement("w:endnote");
        }
        odf.endElement("w:endnotes");
    }

    public static void a(ode ode, odf odf) throws IOException {
        ew.assertNotNull("dctx should not be null!", ode);
        ew.assertNotNull("w should not be null!", odf);
        TextDocument textDocument = ode.pxJ;
        ew.assertNotNull("textDoc should not be null!", textDocument);
        mdl dDT = textDocument.dDT();
        ew.assertNotNull("mainDoc should not be null!", dDT);
        msq dEA = dDT.dEA();
        if (dEA != null) {
            if (quF == null) {
                quF = new HashMap<>();
            }
            a(textDocument, dEA, odf);
        }
    }

    public static void dispose() {
        if (quF != null) {
            quF.clear();
        }
    }
}